//
//  TOBaseScrollView.m
//  SeaGullFM
//
//  Created by dllo on 15/12/1.
//  Copyright © 2015年 tianou. All rights reserved.
//

#import "WSBaseScrollView.h"

@implementation WSBaseScrollView

-(instancetype) initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            self.backgroundColor = COLOR_BTN_NIGHT;
        }
        else
        {
            self.backgroundColor = COLOR_BTN_DAY;
        }
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    }
    
    return self;
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeColor" object:nil];
}

-(void)changeColor:(NSNotification *)notifition
{
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"])
    {
        self.backgroundColor = COLOR_BTN_NIGHT;
        
    }
    else
    {
        self.backgroundColor = COLOR_BTN_DAY;
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
